<extend name='Yg/index' />
<block name="main">

<div class="container">
        <div class="row">
            <div class="col-lg-12">
                <h2 class="page-header">
                    <{$title}>
                </h2>
                <ol class="breadcrumb">
                    <li class="active">
                        <i class="fa fa-dashboard"></i> 您的位置 => <{$title}>
                    </li>
                </ol>
            </div>
        </div>
        
    </div>

<div class="row">
    <div class="col-md-12 ">
        <form action="<{:U('Email/insert')}>" method="post" class="h3">
        
            <!-- 邮件标题 -->
            <div style="font-size:25px;margin-left:16px;">
            <h3>邮件标题:</h3>
            <input type="text" name="etitle" placeholder="请输入邮件标题" style="width:700px;"><br><br>
            </div>
            


            <div class=" col-md-10">
                <label for="inputPassword3" class="col-md-2 control-label">部门:</label>
                <select class="col-md-3" onchange="Change()" id="sel">
                            <option>请选择</option>
                      <volist name='group' id='v'>
                           <option value=<{$i}>><{$v}></option>
                      </volist >
                </select>

                <label for="inputPassword3" class="col-md-2 control-label">收件人:</label>
                <select class="col-sm-3" id="ajax1">
                 
                </select>

                <!-- <button  onclick="name123();return false;" style="margin-left:15px;"> 确认添加</button> -->
                &nbsp;&nbsp;&nbsp;<input type="button" onclick="name123(); return false;" value='添加' />
                <input type='text' id='tianjia' name='receiveid' readonly style="width:700px;margin-top:20px;">

                <!-- <textarea style="width:300px;height:300px;position:absolute;bottom:35px;right:-150px;" name="name" id="" cols="30" rows="10"></textarea> -->
                <script type="text/javascript">
                    function name123(){
                        var info = document.getElementById('ajax1').value;
                        var tianjia = document.getElementById('tianjia');
                        tianjia.value += info+',';
                    }
                </script>
                
                <script id="container" name="econtent" type="text/plain" style="width:660px;height:150px;margin-top:20px;">
                </script>

                <input type="hidden" name="sendid" value="<{$Think.session.user.name}>">
                <button onclick="submitEditor()"/ class="btn btn-success" >提交</button>
     
    </div>
</div>
        </form>

    <script type="text/javascript" charset="utf-8" src="__PUBLIC__/UEDITOR/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="__PUBLIC__/UEDITOR/ueditor.all.js"></script>
      <script type="text/javascript">
        var ue = UE.getEditor('container');
        function submitEditor()  {        
            if(ue.hasContents()){      
                ue.sync();
                document.MyForm.submit();   
                }  
            }  
    </script>
  
   <script>  
        function Change(){
        //清空之前查询的
        $('#ajax1').empty();
        //获得下拉框值
        var groupid=$("#sel").val();
        var ajax1 = document.getElementById('ajax1'); 
        
        $.ajax({
                type:"POST",
                url:"<{:U('Email/doAjax')}>",
                dateType:'json',
                data: {"groupid":groupid},
                success:function (data){
                    
                    for (var i = 0; i < data.length; i++) {
                       ajax1.add(new Option(data[i]['name']));   
                    };
   
                }
            });
}
         
    </script>
</block>